$title Taxin model

* ----------------------------------------------------------------------------
* Closed economy with taxes on input.
* Laurent Cretegny, CoPS, Monash University, Australia, 2004.
* ----------------------------------------------------------------------------

$if not exist taxin.gdx $call gdxxrw i=taxin.xls o=taxin.gdx index=declare

sets
  s                 sector
  o                 commodity
  f                 primary factor;

parameters
  sam(*,*)          benchmark social accounting matrix
  supply(s,o)       supply of output [[sppl:s*o]]
  interm(o,s)       intermediate demand [[intr:o*s]]
  factor(f,s)       factor demand [[fctr:f*s]]
  demand(o)         demand for consumption [[dmnd:o]]
  govdem(o)         government demand [[gvdm:o]]
  endow(f)          endowment [[endw:f]]
  etrn(s)           elasticity of transformation [[etrn:s]]
  esub(s)           elasticity of substitution [[esub:s]]
  esubc             elasticity of substitution for consumption [[esbc:]]
  bti(o,s)          tax rate on intermediate demand [[bti:o*s]]
  btf(f,s)          tax rate on primary factor [[btf:f*s]]
  bpf(f,s)          benchmark price for primary factor [[bpf:f*s]];

$gdxin taxin
$load s o f etrn esub esubc sam
$gdxin

supply(s,o) = sam(s,o);
interm(o,s) = sam(o,s);
factor(f,s) = sam(f,s);
demand(o) = sam(o,"ra");
govdem(o) = sam(o,"gov");
endow(f) = sam("ra",f);
bti(o,s) = 0;
btf("cap",s)$factor("cap",s) = sam("tcap",s) / factor("cap",s);
bpf(f,s) = 1 + btf(f,s);

$if not exist taxin.har $include gdxtohar

$ontext
$model:taxin

$sectors:
  y(s)              ! production
  u                 ! utility index
  g                 ! government expenditure

$commodities:
  pd(o)             ! domestic price of commodity
  pf(f)             ! price of primary factor
  pu                ! price index for utility
  pg                ! price of a government output unit

$consumers:
  ra                ! representative agent income
  gov               ! government income

$prod:y(s)          t:etrn(s)           va:esub(s)
  o:pd(o)           q:supply(s,o)
  i:pd(o)           q:interm(o,s)       a:gov          t:bti(o,s)
  i:pf(f)           q:factor(f,s)       p:bpf(f,s)     a:gov     t:btf(f,s)     va:

$prod:u             s:esubc
  o:pu              q:(sum(o, demand(o)))
  i:pd(o)           q:demand(o)

$prod:g
  o:pg              q:(sum(o, govdem(o)))
  i:pd(o)           q:govdem(o)

$demand:ra
  d:pu
  e:pf(f)           q:endow(f)

$demand:gov
  d:pg

$report:
  v:rsupply(s,o)    o:pd(o)             prod:y(s)
  v:rdemand(o)      i:pd(o)             prod:u

$offtext
$sysinclude mpsgeset taxin

* Benchmark replication

taxin.iterlim = 0;
$include taxin.gen
solve taxin using mcp;
abort$(abs(taxin.objval) gt 1e-7) "*** taxin does not calibrate ! ***";
taxin.iterlim = 1000;

* Fixation of a numeraire to allow comparison

pu.fx = pu.l;

* Counterfactual : uniform tax on labour and capital

bti(o,"sind") = 0.25;
btf(f,"sind") = 0.25;

$include taxin.gen
solve taxin using mcp;

* Results

parameters
  res_com           results by commodity in % change from basis
  res_agg           aggregate results in % change from basis; 

res_com("sagr",o) = (rsupply.l("sagr",o)/supply("sagr",o) - 1) * 100;
res_com("sind",o) = (rsupply.l("sind",o)/supply("sind",o) - 1) * 100;
res_com("demand",o) = (rdemand.l(o)/demand(o) - 1) * 100;
res_com("price",o) = (pd.l(o) - 1) * 100;

res_agg("u") = (u.l - 1) * 100;
res_agg("pu") = (pu.l - 1) * 100;
res_agg("ra_inc") = (ra.l/(sum(o, demand(o))) - 1) * 100;

option decimals = 6;
display res_com, res_agg;
